package com.example.werewolf.service.impl;

import com.example.werewolf.common.ActionType;
import com.example.werewolf.service.ActionStrategy;
import com.example.werewolf.service.impl.role.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ActionStrategyFactory {

    @Autowired
    private WerewolfActionStrategy werewolfStrategy;

    @Autowired
    private VotingActionStrategy votingStrategy;

    @Autowired
    private WitchActionStrategy witchStrategy;

    @Autowired
    private ProphetActionStrategy prophetStrategy;

    @Autowired
    private SpeechActionStrategy speechActionStrategy;

    @Autowired
    private RallyActionStrategy rallyActionStrategy;

    @Autowired
    private ChiefVotingActionStrategy chiefVotingActionStrategy;

    public ActionStrategy getStrategy(ActionType actionType) {
        return switch (actionType) {
            case WEREWOLF_KILL -> werewolfStrategy;
            case EXILE_VOTE -> votingStrategy;
            case WITCH_ACTION -> witchStrategy;
            case PROPHET_CHECK -> prophetStrategy;
            case SPEECH -> speechActionStrategy;
            case RALLY -> rallyActionStrategy;
            case CHIEF_VOTE -> chiefVotingActionStrategy;
            default -> throw new IllegalArgumentException("未知行动类型: " + actionType);
        };
    }
}
